<?php

/*
	This file is part of Rectemplater
	Template.php - Interface and Factory for template classes.

	Copyright (C) 2022  Free Software Foundation, Inc

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU Affero General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Affero General Public License for more details.

	You should have received a copy of the GNU Affero General Public License
	along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

// TODO: See spl_autoload_register
include __ROOT__ . "/templates/DefaultTemplate.php";
include __ROOT__ . "/templates/audio_video/AudioVideoTemplate.php";


interface Template {
	public function load(array $data);
	public function insert(array $entry);
	public function generate(): string;
}


class TemplateFactory {

	public const AUDIO_VIDEO = 1;

	static public function build($template): Template {
		switch ($template) {

			case self::AUDIO_VIDEO:
				return new AudioVideoTemplate();
			
			default:
				return new DefaultTemplate();

		}
	}

}
